package p200;

public class Leetcode_278 {
    public int firstBadVersion(int n) {
        int l = 1, h = n;
        while (l < h) {
            int m = (l + h) >>> 1;
            if (isBadVersion(m)) {
                h = m;
            } else {
                l = m + 1;
            }
        }
        return h;
    }

    private boolean isBadVersion(int version) {
        return version == 3;
    }

    public static void main(String[] args) {
        Leetcode_278 l = new Leetcode_278();
        System.out.println(l.firstBadVersion(5));
    }
}
